package cn.fengzhilun.javase.day11;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import org.junit.Test;

import cn.fengzhilun.javase.day10.ex.Student;

public class TestSetAndMap {
	@Test
	public void test1() {
		Set<Student> set =new HashSet<>();
		set.add(new Student("张三",88));
		set.add(new Student("李四",88));
		
//		for(int i=0;i<set.size();i++) {
//			System.out.println();
//		}
		for(Student s:set) {
			System.out.println(s);
		}
		
		Iterator<Student> itr=set.iterator();
		while(itr.hasNext()) {
			System.out.println(itr.next());
		}
		
	}
	@Test
	public void test2() {
		int[] array= {10,5,39,15,8,5,8};
		Set<Integer> set =new HashSet<>();
		for(int i=0;i<array.length;i++) {
			set.add(array[i]);
		}
		System.out.println(set.size());
		System.out.println(set);
	}
}
